from rest_framework import serializers

from .validators import regexp_validator


class FontCSSQuerySerializer(serializers.Serializer):
    weight = serializers.IntegerField(max_value=1000, min_value=1, default=400)
    name = serializers.CharField(
        max_length=32,
        trim_whitespace=True,
        min_length=1,
        validators=(
            regexp_validator(r'[\w-]+'),
        ),
        default=None,
        allow_null=True
    )
    style = serializers.ChoiceField(
        choices=('normal', 'italic'),
        default='normal'
    )
